package util;

/**
 * Created by gcortes on 1/6/14.
 */
public class Markdown implements Builder<String> {
    private StringBuffer buffer;

    @Override
    public String build() {
        return buffer.toString();
    }

    public Markdown append(final String input) {
        buffer.append(input);
        return this;
    }

    public Markdown heading(final String input) {
        buffer.append(input + "/n");
        for (int i = 0; i < input.length(); i++) {
            buffer.append("=");
        }
        buffer.append("/n");
        return this;
    }

    public Markdown subheading(final String input) {
        buffer.append(input + "/n");

        return this;
    }

    public Markdown italic(final String input) {
        buffer.append("*" + input + "*");
        return this;
    }

    public Markdown bold(final String input) {
        buffer.append("**" + input + "**");
        return this;
    }

    public Markdown monospace(final String input) {
        buffer.append("'" + input + "'");
        return this;
    }

    public Markdown link(final String link) {
        buffer.append("(" + link + ")");
        return this;
    }

    public Markdown link(final String input, final String link) {
        buffer.append("[" + "](" + link + ")");
        return this;
    }

    public Markdown unorderedList(final Iterable<String> input) {
        for (String s : input) {
            buffer.append("/t* " + input + "/n");
        }
        return this;
    }
}
